package com.pdg.mcplugin.common.baseclasses;

import com.pdg.mcplugin.common.interfaces.FeatureManager;
import com.pdg.mcplugin.common.interfaces.Features;

public class FeatureManagerBase<E extends PluginBase,F extends Features> extends PluginClientBase<E> implements FeatureManager<F>{

	public FeatureManagerBase(E thePlugin) {
		super(thePlugin);
	}

	public boolean getFeature(F theFeature){
		return getPlugin().getConfig().getBoolean(theFeature.getConfigSection(),theFeature.getDefaultValue());
	}
	
	public void setFeature(F theFeature,boolean theValue){
		getPlugin().getConfig().set(theFeature.getConfigSection(), theValue);
		getPlugin().saveConfig();
	}
	
	public void restoreDefaultFeatureValue(F theFeature){
		setFeature(theFeature,theFeature.getDefaultValue());
	}

}
